//define(['../module'], function (module) {
define(['app'], function (app) {
  'use strict';
  app.run(['$rootScope', '$state', 'Auth', function ($rootScope, $state, Auth) {
    $rootScope.menus = [];

    var menus = {
      seq: 1,
      name: ' 基础设置',
      sref: 'base',
      'icon': 'fa-setting',
      childs: [
        {
          seq: 1,
          name: ' 用户',
          'icon': 'fa-circle-o',
          sref: 'app.base.users.list'
        },
        {
          seq: 1,
          name: ' 用户1',
          'icon': 'fa-circle-o',
          sref: 'app.base.users1.list'
        }
      ]
    };
    $rootScope.menus.push(menus.childs[0]);
    $rootScope.menus.push(menus.childs[1]);

    //$rootScope.$on("$stateChangeStart", function (event, toState, toParams, fromState, fromParams) {
    //  //if(!('data' in toState) || !('access' in toState.data)){
    //  //  $rootScope.error = "Access undefined for this state";
    //  //  event.preventDefault();
    //  //}
    //  else if (!Auth.authorize(toState.data.access)) {
    //    $rootScope.error = "Seems like you tried accessing a route you don't have access to...";
    //    event.preventDefault();
    //
    //    if(fromState.url === '^') {
    //      if(Auth.isLoggedIn()) {
    //        $state.go('user.home');
    //      } else {
    //        $rootScope.error = null;
    //        $state.go('anon.login');
    //      }
    //    }
    //  }
    //});
  }]);
});
